<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@taglib uri="http://www.springframework.org/tags" prefix="spring"%>
<%@taglib uri="http://www.springframework.org/tags/form" prefix="form"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="tiles" uri="http://tiles.apache.org/tags-tiles" %>

	<link type="text/css" rel="stylesheet" href="../resources/css/bootstrap.min.css" />
	<link type="text/css" rel="stylesheet" href="../resources/css/style.css" />
	<script type="text/javascript" src="../resources/js/jquery.js"></script>
	<script type="text/javascript" src="../resources/js/bootstrap.min.js"></script>
	
	<script type="text/javascript">
	function trovetrangtruoc(){
		window.history.back();
	}
	
	</script>

<a class="btn btn-primary" onclick="trovetrangtruoc()">Trở về</a>

<c:choose>
	<c:when test="${!empty listPhanCong}">
		<table class="table table-hover" id="table">
		<tr>
			<th width="80">ID Phân công</th>
			<th width="80">Mã Công Văn</th>
			<th width="80">GV/BM được phận công</th>
			<th width="120">Người phân công</th>
			<th width="120">Ngày phân công</th>
			<th width="120">Hạn cuối</th>
			<th width="120">Xác nhận hoàn tất</th>
			<th width="120">Xác nhận BCN</th>	
		</tr>
		<c:forEach items="${listPhanCong}" var="phancong">
		<c:if test="${!empty phancong.phancongcongvandenGiangvien.giangvien.canbo.tenCanBo}">
			<tr id="rows">
				<td>${phancong.idPhanCong}</td>
				<td>${phancong.congvanden.idCongVanDen}</td>
				<td>${phancong.phancongcongvandenGiangvien.giangvien.canbo.tenCanBo}</td>
				<td>${phancong.nguoiPhanCong}</td>
				<td><fmt:formatDate value="${phancong.ngayPhanCong}" pattern="dd-MM-yyyy" /></td>
				<td><fmt:formatDate value="${phancong.hanCuoi}" pattern="dd-MM-yyyy" /></td>
				<c:choose>
					<c:when test="${phancong.xacNhanHoanTat == 1}">
						<td><input type="checkbox" id="xacnhanhoantat_tb" checked/></td>
					</c:when>
					<c:otherwise>
						<td><input type="checkbox" id="xacnhanhoantat_tb" /></td>
					</c:otherwise>
				</c:choose>
				<c:choose>
					<c:when test="${phancong.xacNhanBcn == 1}">
						<td><input type="checkbox" id="xacnhanbcn_tb" checked/></td>
					</c:when>
					<c:otherwise>
						<td><input type="checkbox" id="xacnhanbcn_tb"/></td>
					</c:otherwise>
				</c:choose>
				
			 </tr>
		</c:if>
			</c:forEach>
		<c:forEach items="${listPhanCong}" var="phancong">
			<c:if test="${!empty phancong.phancongcongvandenBomon.bomon.tenBoMon}">
			<tr id="rows">
				<td>${phancong.idPhanCong}</td>
				<td>${phancong.congvanden.idCongVanDen}</td>
				<td>${phancong.phancongcongvandenBomon.bomon.tenBoMon}</td>
				<td>${phancong.nguoiPhanCong}</td>
				<td><fmt:formatDate value="${phancong.ngayPhanCong}" pattern="dd-MM-yyyy" /></td>
				<td><fmt:formatDate value="${phancong.hanCuoi}" pattern="dd-MM-yyyy" /></td>
				<c:choose>
					<c:when test="${phancong.xacNhanHoanTat == 1}">
						<td><input type="checkbox" id="xacnhanhoantat_tb" checked/></td>
					</c:when>
					<c:otherwise>
						<td><input type="checkbox" id="xacnhanhoantat_tb"/></td>
					</c:otherwise>
				</c:choose>
			<c:choose>
					<c:when test="${phancong.xacNhanBcn == 1}">
						<td><input type="checkbox" id="xacnhanbcn_tb" checked/></td>
					</c:when>
					<c:otherwise>
						<td><input type="checkbox" id="xacnhanbcn_tb"/></td>
					</c:otherwise>
				</c:choose>
				
			 </tr>
			 </c:if>
			</c:forEach>
		
	</table>
</c:when>
<c:otherwise>
	<div class="alert alert-dismissable alert-warning">
  <button type="button" class="close" data-dismiss="alert">×</button>
  <p>Không có phân công công văn đến nào để hiển thị !!!</p>
</div>					
</c:otherwise>
</c:choose>
